#ifndef RENDERCOMPONENT_H
#define RENDERCOMPONENT_H

#include "Component.h" // Base class: Component

#include "core/Object.h"
#include "gameobjects/GameObject.h"

#include "utils/OBBoxRenderable.h"


class RenderComponent : public Component
{

public:
	RenderComponent();
	RenderComponent(ComponentContainer* c, const std::string& name);
	RenderComponent(ComponentContainer* c, const std::string& name, const std::string& mesh);
	RenderComponent(ComponentContainer* c, const std::string& name, Ogre::Entity* ent) :
		Component(c, name),	mGo(0), mEntity(ent), mOBBox(0), mMeshName(0) { init(); }

	virtual ~RenderComponent();

	void init();

	void loadMesh(std::string file);

	void updateMaterial();
	void setMaterialName(std::string name);

	virtual std::string toString(void) const { return "RenderComponent"; }

private:
	void _createOBBox();
	void _deleteOBBox();
	void showOBBox();

protected:
	::Object mRenderer;
	::Object mMaterial;

//	Property<Mesh*>* mMesh;
	Property<std::string>* mMeshName;
	::GameObject* mGo;
	Ogre::Entity* mEntity;

	sigc::connection obboxCon;
	Property<bool>* mShowOBBox;
	OBBoxRenderable* mOBBox;
};

#endif // RENDERCOMPONENT_H
